import React from 'react';
import { BrowserRouter, Route, Switch} from 'react-router-dom'
import Add from './pages/Add';
import Edit from './pages/Edit';
import Home from './pages/Home';
import Person from './pages/Person';
import View from './pages/View';
function App() {
  return (
    <BrowserRouter>
        <>
          {/* 根据URL路径匹配路由组件，渲染到该位置 */}
          <Switch>
            <Route exact path="/"  component={Home}/>
            <Route exact path="/View/:id" component={View}/>
            <Route exact path="/Person" component={Person}/>
            <Route exact path="/Person/Add" component={Add}/>
            <Route exact path="/Person/Edit/:id" component={Edit}/>
            <Route exact path="/Person/View/:id" component={View}/>
            {/* 这是一个默认页面，如果前面的路由都没有被匹配到，就会渲染这个组件，相当于404，一定要放到最后 */}
            {/* <Route component={NotFound} /> */}
          </Switch>
        </>
      </BrowserRouter>
  );
}

export default App;
